/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
#ifndef DEVICELAYER_H_
#define DEVICELAYER_H_

#include "MaCI.hpp"
#include "wx/wx.h"

/**
Layer for display canvas that displays some data and handles events

This is only an interface. Different types of layers, eg. ranging,
are derived from this. Each data layer can have its own actions menu that is 
added to clientUnits menu. Layers can have their own coordinate systems which 
other layers can use by calling GLTransform function. Device layer can be bound 
to one reference layer using SetRefLayer , for example ranging data is useful to 
bind to units position.
*/

namespace MaCIGUI
{

class CMachineUnit;

class CDeviceLayer
{
  public:
    CDeviceLayer(std::string Name, CMachineUnit* machineUnit, 
                MaCI::CMaCI* MaCIClient);

    virtual ~CDeviceLayer();
    
    virtual void Draw(float viewLeft, float viewRight, float viewTop, float viewBottom, float scale)=0;//GLuint renderMode, float alpha); //called when layer is wanted to be drawn

    virtual void OnClick(float x, float y)=0;
    virtual void OnKey(int keyCode)=0;
    virtual void OnKeyUp(int keyCode)=0;
    virtual void OnKillFocus()=0;
    
    virtual void Update(int timeout)=0;

    virtual void GLTransform()=0; //transform to this layers coordinate frame

    virtual float GetX() = 0;
    virtual float GetY() = 0;
    /*
    set the layer that represents the units coordinatesystem
    */
    void SetRefLayer(CDeviceLayer* deviceLayer);

    CMachineUnit* MachineUnit;
    MaCI::CMaCI* MaCIClient;
    std::string Name;
    bool Enabled;  //Tells if the devices checkbox on the list is selected
    bool selectionOnDevice; //Tells if the device is selected on the list
    int z;
    CDeviceLayer* refLayer;
    //wxMenu Menu; //actions menu for device layer

};

}

#endif /*DEVICELAYER_H_*/
